<%@ page import="com.tianxiabuyi.utils.ErrcodeUtil" %>
<%@ page import="java.util.List" %>
<%--
  Created by IntelliJ IDEA.
  User: lujw
  Date: 2017/6/8
  Time: 13:18
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/common/validate.jsp"%>
<%
    String phone = input.getDesc("phone", "");
    msg.put("data", Collections.EMPTY_MAP);
    if (ValidateUtil.isEmpty(phone)) {
        Tools.encryptPrint(out, msg);
        return;
    }
    if (!ValidateUtil.validatePhone(phone)) {
        Tools.encryptPrint(out, msg);
        return;
    }
    List<HospitalUser> hospitalUsers = QBuilder.db("basedb").select().from("HospitalUser").where(new Where("phone=", phone).and("status=", ConstantUtil.STATUS_ENABLE)).page(1, 1).query().getResultObj();
    if (hospitalUsers.size() == 0) {
        ErrcodeUtil.setErrcode(msg, ErrcodeUtil.NO_USER);
        Tools.encryptPrint(out, msg);
        return;
    }
    HospitalUser hospitalUser = hospitalUsers.get(0);
    hospitalUser.setPassword(parameters.get("password"));
    DBTools.db("basedb").modItem(hospitalUser, hospitalUser.getId());
    Tools.encryptPrint(out, msg);
%>
